package com.example.movie_control;

public class Hall {
    private String hallId;
    private String hallName;
    private int rowCount;
    private int colCount;
    private boolean[][] seats;

    public Hall(String hallId, String hallName, int rowCount, int colCount) {
        this.hallId = hallId;
        this.hallName = hallName;
        this.rowCount = rowCount;
        this.colCount = colCount;
        this.seats = new boolean[rowCount][colCount];
        for (int i = 0; i < rowCount; i++) {
            for (int j = 0; j < colCount; j++) {
                seats[i][j] = false;
            }
        }
    }

    public boolean sellSeat(int row, int col) {
        if (row < 0 || row >= rowCount || col < 0 || col >= colCount) {
            return false;
        }
        if (!seats[row][col]) {
            seats[row][col] = true;
            return true;
        }
        return false;
    }

    public boolean refundSeat(int row, int col) {
        if (row < 0 || row >= rowCount || col < 0 || col >= colCount) {
            return false;
        }
        if (seats[row][col]) {
            seats[row][col] = false;
            return true;
        }
        return false;
    }

    // Getter
    public String getHallId() { return hallId; }
    public String getHallName() { return hallName; }
    public int getRowCount() { return rowCount; }
    public int getColCount() { return colCount; }
    public boolean[][] getSeats() { return seats; }
}